import { createRouter, createWebHistory } from 'vue-router'
import Layout from '@/views/Layout.vue'
import Home from '@/views/Home.vue'
import Categroy from '@/views/Categroy.vue'
import Cart from '@/views/Cart.vue'
import My from '@/views/My.vue'
import Collage from '@/views/Collage.vue'
import Order from '@/views/Order.vue'

const router = createRouter({
    history: createWebHistory(import.meta.env.BASE_URL),
    routes: [
        {
            path: '/',
            component: Layout,
            redirect: '/home',
            children: [
                {
                    path: '/home',
                    name: 'home',
                    component: Home,
                },
                {
                    path: '/categroy',
                    name: 'categroy',
                    component: Categroy,
                },
                {
                    path: '/collage',
                    name: 'collage',
                    component: Collage,
                },
                {
                    path: '/cart',
                    name: 'cart',
                    component: Cart,
                },
                {
                    path: '/order',
                    name: 'order',
                    component: Order,
                },
                {
                    path: '/my',
                    component: My,
                },
            ],
        },
        //详情
        {
            path: '/detail',
            name: 'detail',
            component: () => import("../views/Detail.vue"),
        },

        //登录
        {
            path: '/login',
            name: 'login',
            component: () => import("../views/Login.vue"),
        },
        //设置
        {
            path: '/setup',
            name: 'setup',
            component: () => import("../views/setup.vue"),
        },
        //推广app
        {
            path: '/invite',
            name: 'invite',
            component: () => import("../views/invite.vue"),
        },
        // 邀请好友拼团
        {
            path: '/invitation',
            name: 'invitation',
            component: () => import("../components/invitation.vue"),
        },
        // 拼团失败 查看详情
        {
            path: '/viewDetails',
            name: 'viewDetails',
            component: () => import("../components/viewDetails.vue"),
        },
        // 拼团成功 查看订单
        {
            path: '/viewOrder',
            name: 'viewOrder',
            component: () => import("../components/viewOrder.vue"),
        },
        //注册
        {
            path: '/register',
            name: 'register',
            component: () => import("../views/register.vue"),
        },
        //订单
        {
            path: '/Myorder',
            name: 'Myorder',
            component: () => import("../views/Myorder.vue"),
        },
        //404页面
        {
            path: '/:pathMatch(.*)*',
            component: () => import('@/views/NotPage.vue'),

        },
        // 查询页面
        //搜索
        {
            path: '/search',
            name: 'search',
            component:
                () => import("../views/searchGoods.vue"),
        },
        // 全部商品列表
        //商品列表
        {
            path: '/shoplist',
            name: 'shoplist',
            component:
                () => import("../views/shopList.vue"),
        },
        //收藏
        {
            path: '/Collection',
            name: 'Collection',
            component:
                () => import("../views/Collection.vue"),
        },
        //收货地址
        {
            path: '/addressList',
            name: 'addressList',
            component:
                () => import("../views/addressList.vue"),
        },
         //编辑地址
         {
            path: '/addressEmit',
            name: 'addressEmit',
            component:
                () => import("../views/addressEmit.vue"),
        },
        //404页面
        {
            path: '/:pathMatch(.*)*',
            component: () => import('@/views/NotPage.vue'),

        },


    ]
})

export default router